﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Data;
using Entities;
using System.Data;
namespace Business
{
    public class TheLoaiService
    {
        public static List<TheLoaiDTO> GetTheLoaiList()
        {
            List<TheLoaiDTO> kq = new List<TheLoaiDTO>();
            try
            {
                kq = TheLoaiRepository.GetTheLoaiList();
            }
            catch (System.Exception e)
            {
                string s = e.Message;
            }
            return kq;
           
        }
        public static TheLoaiDTO GetTheLoaiByMaLoai(int maTheLoai)
        {
            TheLoaiDTO kq=new TheLoaiDTO();

            try
            {
                kq=TheLoaiRepository.GetTheLoaiByMaTheLoai(maTheLoai);
            }
            catch (System.Exception e)
            {
            	
            }
            return kq;
        }
        public static DataTable GetTheLoaiTable()
        {
            DataTable kq = new DataTable();
            List<TheLoaiDTO> list = TheLoaiRepository.GetTheLoaiList();
            kq = ConvertTo.DataTable(list);
            return kq;
        }
        public static bool CheckDelete(int maTheLoai)
        {
            return TheLoaiRepository.CheckDelete(maTheLoai);
        }
      
        
        public static void Delete(int MaTheLoai)
        {
            
              TheLoaiRepository.Delele(MaTheLoai);
            
        }
        public static bool Update(TheLoaiDTO theLoai)
        {

            try
            {
                TheLoaiRepository.Update(theLoai);
            }
            catch (System.Exception e)
            {
                return false;
            }
            return true;
        }
        public static bool Insert(TheLoaiDTO theLoai)
        {

            try
            {
                TheLoaiRepository.Insert(theLoai);
            }
            catch (System.Exception e)
            {
                return false;
            }
            return true;
        }
        public static int GetCurrentID()
        {
            return TheLoaiRepository.GetCurrentID();
        }
    }
}
